class SymAm extends egret.DisplayObjectContainer {
	private text:any;
	private cuId:any;
	private ract:any;
	private am:any;
	public constructor(ract:any,text:any) {
		super();
		this.text = text;
		this.ract  = ract;
		this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
	}

	private onAddToStage():void{
         this.cuId = 1;
	     var img = new eui.Image();
		 this.am = img;
        img.source = this.text+this.cuId;
        img.width = this.ract;
        img.height = this.ract;
        this.height = this.ract;
        this.width = this.ract;
        this.addChild(img);
		this.openAm();
	}
	public openAm(): void {
		this.removeEventListener(egret.Event.ENTER_FRAME, this.enterFrameHandler, this);
		this.addEventListener(egret.Event.ENTER_FRAME, this.enterFrameHandler, this);
	}

	/**打开时逐帧运动*/
	private enterFrameHandler(event: egret.Event): void {
		if (this.cuId < 40) {
			this.cuId += 1;
		} else {
			this.cuId = 1;
		}
		var imgId = (this.cuId+1)/2;
		var test = parseInt(imgId.toString());
		this.am.source = this.text+test;
	}

	/**暂停打开时动画*/
	public pauseAm(): void {
		this.removeEventListener(egret.Event.ENTER_FRAME, this.enterFrameHandler, this);
	}

}

